package com.hp.tiger.concurrent.classloader.chapter3;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author XavierDong
 **/
public class MyClassLoaderTest {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {

        MyClassLoader myClassLoader = new MyClassLoader("MyClassLoader");
        Class<?> aClass = myClassLoader.loadClass("com.hp.tiger.concurrent.classloader.chapter3.MyObject");
        System.out.println(aClass);
        System.out.println(aClass.getClassLoader());

        Object object = aClass.newInstance();
        Method method = aClass.getMethod("hello", new Class<?>[]{});
        Object invoke = method.invoke(object, new Object[]{});
        System.out.println(invoke);


    }
}
